package com.project.smarthome.login.view;

import android.content.Intent;

import com.project.smarthome.R;
import com.project.smarthome.base.BaseActivity;
import com.project.smarthome.base.NoUserAuthorize;
import com.project.smarthome.login.WelcomeContract;
import com.project.smarthome.login.presenter.WelcomePresenter;
import com.project.smarthome.main.view.MainActivity;


/**
 * Created by CXX on 2015/12/25.
 */
public class WelcomeActivity extends BaseActivity implements WelcomeContract.View, NoUserAuthorize {

    private WelcomeContract.Presenter mPresenter;

    @Override
    protected void initVariable() {
        mPresenter = new WelcomePresenter(this);
    }

    @Override
    protected void initView() {
        setContentView(R.layout.activity_welcome);
    }

    @Override
    protected void loadData() {

        mPresenter.checkPermission(this);
        mPresenter.init();
    }

    /**************************************************异步方法回调区***************************************************/
    @Override
    public void navToLogin() {
        startActivity(new Intent(this, LoginActivity.class));
        finish();
    }

    @Override
    public void navToMain() {
        startActivity(new Intent(this, MainActivity.class));
        finish();
    }

    @Override
    public void showGesture() {
//        Bundle bundle = new Bundle();
//        bundle.putSerializable("toNextPage", MainActivity.class);
//        startActivity(WelcomeActivity.this, GestureVerActivity.class, bundle);
//        finish();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPresenter != null) {
            mPresenter.destroy();
            mPresenter = null;
        }
    }

}
